/* GUI CONVERTED from rciq03.p (converter v1.76) Fri May  3 13:21:12 2002 */
/* rciq03.p - Release Management Customer Schedules                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Revision: 1.8.1.6 $                                                         */
/*V8:ConvertMode=Report                                        */
/* REVISION: 7.3    LAST MODIFIED: 10/16/92           BY: WUG *G462*    */
/* REVISION: 7.3    LAST MODIFIED: 02/18/83           BY: WUG *G695*    */
/* REVISION: 7.3    LAST MODIFIED: 10/18/93           BY: WUG *GG36*    */
/* REVISION: 7.3    LAST MODIFIED: 04/11/94           BY: WUG *H193*    */
/* REVISION: 7.4    LAST MODIFIED: 11/17/94           BY: jxz *GO50*    */
/* REVISION: 7.4    LAST MODIFIED: 11/21/94           BY: GWM *H604*    */
/* REVISION: 7.4    LAST MODIFIED: 09/15/95           BY: vrn *G0VP*    */
/* REVISION: 8.5    LAST MODIFIED: 07/07/95           BY: gwm *J049*    */
/* REVISION: 8.5    LAST MODIFIED: 04/24/96           BY: gwm *J0K9*    */
/* REVISION: 8.5    LAST MODIFIED: 05/15/96           BY: gwm *J0MT*    */
/* REVISION: 8.6    LAST MODIFIED: 08/06/96   BY: *K003* Vinay Nayak-Sujir  */
/* REVISION: 8.6    LAST MODIFIED: 04/02/97   BY: *K09H* Vinay Nayak-Sujir  */
/* REVISION: 8.6    LAST MODIFIED: 10/23/97   BY: *K14Y* ckm              */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane        */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan       */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* myb              */
/* Old ECO marker removed, but no ECO header exists *F0PN*                */
/* Revision: 1.8.1.4     BY: Rajesh Kini      DATE: 03/28/01   ECO: *M13T* */
/* Revision: 1.8.1.5     BY: Steve Nugent     DATE: 07/09/01   ECO: *P007* */
/* $Revision: 1.8.1.6 $    BY: Katie Hilbert    DATE: 04/15/02   ECO: *P03J* */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* AS OF J049 THIS PROGRAM WAS SPLIT INTO TWO SEPARATE PROGRAMS         */
/* ONE FOR PICKLIST/SHIPPER INQUIRY AND A SEPERATE PROGRAM FOR          */
/* CONTAINER INQUIRY                                                    */

/* SHIPPER/CONTAINER INQUIRY */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

define new shared variable indent_id as character format "x(12)".
define shared variable global_recid as recid.
define variable ctype            as character label "T" format "x(1)".
define variable disp_abs_id      as character.
define variable doc_type         like mfc_logical
                                 format "Pre-Shipper/Shipper"
                                 initial true no-undo.
define variable l_status         as   character format "X(1)" no-undo.
define variable v_absd_fld_seq   like absd_fld_seq no-undo.
define variable v_absd_fld_name  like absd_fld_name no-undo.
define variable v_absd_fld_value like absd_fld_value no-undo.

/* VARIABLE DEFINITIONS FOR gpfile.i */
{gpfilev.i}


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
abs_shipfrom         colon 28 label "Ship-From"
   si_desc              at 45 no-label
   doc_type             colon 28 label "Pre-Shipper/Shipper"
   abs_id               colon 28 label "Number"
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/* TRANSLATIONS: The format for abs_canceled or "Status" may be
translated. This is to be handled similiar to po_stat. However the
difference is po_stat is a character field while this is a logical
one. The format "X/" means display "X" when the flag is true and
"" (blank) when the flag is false. */
FORM /*GUI*/ 
   abs_shipto           colon 18 label "Ship-To/Dock"
   ad_name              at 30 no-label
   abs_canceled         colon 67 label "Status" format "X/"
              skip (.1)                                         
   abs_master_id        colon 18 label "Master Bill"
   abs_inv_mov          colon 67
with STREAM-IO /*GUI*/  frame b side-labels width 80 attr-space.

/* SET EXTERNAL LABELS */
setFrameLabels(frame b:handle).

/* FORM STATEMENT FOR CONTAINER/LINE CHARGES USER FIELDS FRAME */
FORM /*GUI*/ 
  v_absd_fld_seq
  v_absd_fld_name
  v_absd_fld_value
with STREAM-IO /*GUI*/  down frame absd_user_fields width 80.

/* SET EXTERNAL LABELS */
setFrameLabels(frame absd_user_fields:handle).

/* IS CONTAINER/LINE CHARGES ACTIVE? */
{cclc.i}

find abs_mstr where recid(abs_mstr) = global_recid no-lock no-error.

if available abs_mstr and (abs_id begins "s" or abs_id begins "p")
   and abs_type = "s" then do:

   doc_type = abs_id begins "p".

   find si_mstr where si_site = abs_shipfrom no-lock.

   display
      abs_shipfrom
      si_desc
      doc_type
      substring(abs_id,2,50) @ abs_id
   with frame a.
end.

display doc_type with frame a.

{wbrp01.i}
repeat:
   do with frame a:

      if c-application-mode <> 'web' then
         prompt-for abs_shipfrom doc_type abs_id
      editing:

         assign
            global_site = input abs_shipfrom.

         if frame-field = "abs_shipfrom" then do:

            {mfnp05.i abs_mstr abs_id
               "abs_id begins 's' or abs_id begins 'p' "
               abs_shipfrom
               "input abs_shipfrom"}

            if recno <> ? then do:
               find si_mstr where si_site = abs_shipfrom no-lock no-error.

               disp_abs_id = substring(abs_id,2,50).

               display
                  abs_shipfrom
                  si_desc          when (available si_mstr)
                  ""               when (not available si_mstr) @ si_desc
                  abs_id begins "p" @ doc_type
                  disp_abs_id @ abs_id.
            end.
         end.
         else
         if frame-field = "abs_id" then do:

            assign
               doc_type
               ctype = if input doc_type then "p" else "s".

            {mfnp05.i abs_mstr abs_id
               "abs_shipfrom = input abs_shipfrom
                and abs_id begins ctype"
               abs_id
               "ctype + input abs_id"}
            if recno <> ? then do:
               find si_mstr where si_site = abs_shipfrom no-lock no-error.

               disp_abs_id = substring(abs_id,2,50).

               display
                  abs_shipfrom
                  si_desc          when (available si_mstr)
                  ""               when (not available si_mstr) @ si_desc
                  doc_type
                  disp_abs_id @ abs_id.
            end.
         end.
         else do:
            status input.
            readkey.
            apply lastkey.
         end.
      end.

      {wbrp06.i &command = prompt-for &fields = "  abs_shipfrom doc_type abs_id" &frm = "a"}

   end.

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data')) then do:

      ctype = if input doc_type then "p" else "s".

      find abs_mstr where abs_shipfrom = input abs_shipfrom
         and abs_id = ctype + input abs_id
         and abs_type = "s"
         no-lock no-error.
      if not available abs_mstr then do:
         /* Picklist/Shipper number does not exist */
         {pxmsg.i &MSGNUM=8108 &ERRORLEVEL=3}
         if c-application-mode = 'web' then return.
         undo, retry.
      end.

      find si_mstr where si_site = abs_shipfrom no-lock.

      hide frame b no-pause.
      hide frame absd_user_fields no-pause.
   end.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   disp_abs_id = substring(abs_id,2,50).

   find ad_mstr where ad_addr = abs_shipto no-lock no-error.

   l_status =
              if abs_canceled
              then
                 "X"
              else
                 if (substring(abs_mstr.abs_status,2,1) = "y")
                 then
                    "C"
                 else
                    "".

   display
      abs_shipto
      ad_name      when (available ad_mstr)
      abs_inv_mov
      l_status @ abs_canceled
      substring(abs_master_id,2) @ abs_master_id
   with frame b STREAM-IO /*GUI*/ .

   put skip(1).

   clear frame absd_user_fields all no-pause.
   /* FIND CONTAINER/LINE CHARGES HEADER USER FIELDS AND DISPLAY */
   if using_container_charges or using_line_charges then do:
      for each absd_det no-lock where
         absd_abs_id = abs_id  and
         absd_shipfrom = abs_shipfrom:

         display
            absd_fld_seq   @ v_absd_fld_seq
            absd_fld_name  @ v_absd_fld_name
            absd_fld_value @ v_absd_fld_value
         with frame absd_user_fields STREAM-IO /*GUI*/ .

         down 1 with frame absd_user_fields.
      end. /* FOR EACH absd_det */
   end. /* IF using_container or using_line_charges */

   {gprun.i ""rciq03c.p"" "(input recid(abs_mstr), input 0)"}

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}

   if abs_par_id > "" then do:
      /* This is subordinate to # */
      {pxmsg.i &MSGNUM=8102 &ERRORLEVEL=1 &MSGARG1=caps(abs_par_id)}
   end.

   assign
      global_recid = recid(abs_mstr).
end.
{wbrp04.i &frame-spec = a}
